<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=utf-8"%>
<%@ page import="entity.Payment"%>
<%@ page import="dao.PaymentDAO"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
</head>
<body>
	<div class="panel admin-panel">
		<div class="panel-head">
			<strong><span class="icon-key"></span>更新收付情况</strong>
		</div>
		<div class="body-content">
			<form method="post" class="form-x" action="paycheck">
				<%
					String cno = request.getParameter("cno");
					PaymentDAO payDAO = new PaymentDAO();
					Payment pay = payDAO.getPaymentByCno(cno);
				%>
				<div class="form-group">
					<div class="label">
						<label for="sitename">合同编号：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" name="cno" size="50"
							value='<%=pay.getCno()%>' readonly>
					</div>
				</div>

				<div class="form-group">
					<div class="label">
						<label for="sitename">合同金额：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" size="50" name="contractp"
							value='<%=pay.getContractp()%>' readonly>
					</div>
				</div>

				<div class="form-group">
					<div class="label">
						<label for="sitename">已收付金额：</label>
					</div>
					<div class="field">
						<input type="text" name="payprice" class="input w50" size="50"
							value='<%=pay.getPayprice()%>'>
					</div>
				</div>


				<div class="form-group">
					<div class="label">
						<label></label>
					</div>
					<div class="field">
						<button class="button bg-main icon-check-square-o"
							onclick="javascript:return comparep()" type="submit"
							name="Submit">更新</button>
							
						<button class="button bg-main icon-check-square-o">
							<a href="payment.jsp">取消</a>
						</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<script>
		function comparep() {
			var contractp = $("input[name='contractp']").val();
			var payprice = $("input[name='payprice']").val();
			var msg = "您确定要保存吗？\n\n请确认！";
			if (confirm(msg) == true) {
				if (eval(contractp)<eval(payprice)) {
					alert("应收付金额大于合同金额，操作失败!");
					return false;
				} else {
					alert("更新成功!");
					return true;
				}
			} else {
				return false;
			}
		}
	</script>
</body>
</html>